package com.ck.daoImpl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ck.dao.StudentDAO;
import com.ck.domain.Student;

public class StudentDAOImpl extends SqlMapClientDaoSupport implements StudentDAO {

	public List<Student> getAllStudent() {
		return (List<Student>)getSqlMapClientTemplate().queryForList("getAllStudent");
	}
	
	public List<Student> getStudentByBanji(Integer banji) {
		return (List<Student>)getSqlMapClientTemplate().queryForList("getStudentByBanji",banji);
	}

	public List<Integer> getStudentIdByBanji(Integer banji) {
		return (List<Integer>)getSqlMapClientTemplate().queryForList("getStudentIdByBanji",banji);
	}

	public Student getStudentById(Integer id) {
		return (Student) getSqlMapClientTemplate().queryForObject("getStudentById",id);
	}

	public Student getStudentByUsername(String username) {
		return (Student) getSqlMapClientTemplate().queryForObject("getStudentByUsername",username);
	}

	public void updateStudentLastLoginTime(Student student) {
		getSqlMapClientTemplate().update("updateStudentLastLoginTime", student);
	}

	public void addNewStudent(Student student) {
		getSqlMapClientTemplate().insert("addNewStudent", student);
	}

	public void updateStudentOwnInfo(Student student) {
		getSqlMapClientTemplate().update("updateStudentOwnInfo", student);
	}

	public void updateStudentOwnPassword(Student student) {
		getSqlMapClientTemplate().update("updateStudentPassword", student);
	}

	public void updateStudentInfo(Student student) {
		getSqlMapClientTemplate().update("updateStudentInfo", student);
	}

	public void updateStudentPassword(Student student) {
		getSqlMapClientTemplate().update("updateStudentPassword", student);
	}

}
